package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.BtyCwJs;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyCwJsParam;
import cn.stylefeng.guns.sys.modular.system.service.BtyCwJsService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 货赔酒水单价表控制器
 *
 * @author 
 * @Date 2021-11-22 14:55:34
 */
@Controller
@RequestMapping("/btyCwJs")
public class BtyCwJsController extends BaseController {

    private String PREFIX = "/modular/system/btyCwJs";

    @Autowired
    private BtyCwJsService btyCwJsService;

    /**
     * 跳转到主页面
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyCwJs.html";
    }

    /**
     * 新增页面
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyCwJs_add.html";
    }

    /**
     * 新增冻货与酱料单价页面
     *
     */
    @RequestMapping("/addDh")
    public String addDh() {
        return PREFIX + "/btyCwJs_addDh.html";
    }

    /**
     * 编辑页面
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyCwJs_edit.html";
    }

    /**
     * 编辑冻货与酱料单价页面
     *
     */
    @RequestMapping("/editDh")
    public String editDh() {
        return PREFIX + "/btyCwJs_editDh.html";
    }

    /**
     * 新增接口
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyCwJsParam btyCwJsParam) {
        return this.btyCwJsService.add(btyCwJsParam);
    }

    /**
     * 新增冻货接口
     *
     */
    @RequestMapping("/addDhItem")
    @ResponseBody
    public ResponseData addDhItem(BtyCwJsParam btyCwJsParam) {
        return this.btyCwJsService.addDh(btyCwJsParam);
    }

    /**
     * 编辑接口
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyCwJsParam btyCwJsParam) {
        return this.btyCwJsService.update(btyCwJsParam);
    }

    /**
     * 编辑冻货与酱料单价接口
     *
     */
    @RequestMapping("/editDhItem")
    @ResponseBody
    public ResponseData editDhItem(BtyCwJsParam btyCwJsParam) {
        return this.btyCwJsService.updateDh(btyCwJsParam);
    }

    /**
     * 删除接口
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyCwJsParam btyCwJsParam) {
        this.btyCwJsService.delete(btyCwJsParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author 
     * @Date 2021-11-22
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyCwJsParam btyCwJsParam) {
        BtyCwJs detail = this.btyCwJsService.getById(btyCwJsParam.getPxId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author 
     * @Date 2021-11-22
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyCwJsParam btyCwJsParam) {
        return this.btyCwJsService.findPageBySpec(btyCwJsParam);
    }

}


